home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5468 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.0 KB  |  36 lines

  1. Path: news.uni-jena.de!news
  2. From: mkt@isun04.inf.uni-jena.de (Tilo Koerbs)
  3. Newsgroups: comp.lang.c++
  4. Subject: Strange error in SPARCompiler.
  5. Date: 5 Feb 1996 11:21:03 GMT
  6. Organization: Lehrstuhl fuer Rechnerarchitektur- und kommunikation, FSU Jena
  7. Message-ID: <4f4p6v$ah0@fsuj01.rz.uni-jena.de>
  8. Reply-To: mkt@isun04.inf.uni-jena.de
  9. NNTP-Posting-Host: isun07.inf.uni-jena.de
  10.  
  11. My SPARCompiler 4.0? shows a very strange behaviour:
  12.  
  13. struct X {
  14.     int i1, i2;
  15. };
  16.  
  17. void f(const X& x) {
  18.     int& i  = x.i2;            // Warning: Temporary used... (now obsolete)
  19.     int& ii = 1 ? x.i1 : x.i2;    // NO ERROR, NO WARNING!!!
  20. }
  21.  
  22. Although the first initialization should be an error in a newer compiler, it
  23. is still only a warning (like Borland 4.0).
  24.  
  25. The second initialization in in no part dirrerent from the first. What to hell
  26. is my compiler doing here? It prints not even a warning message!!! And for sure:
  27. it uses NO temporary!
  28.  
  29. Does newer versions of my SPARCompiler have this error too?
  30. And did Borland and SUN changed from a warning to an error?
  31.  
  32. Bye.
  33. Tilo Koerbs,  mkt@uni-jena.de
  34.  
  35.  
  36.